package com.management.department.teacherinfosystem.Repository;
import com.management.department.teacherinfosystem.Entity.TeachingProject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface TeachingProjectRepository extends JpaRepository<TeachingProject, Long>, JpaSpecificationExecutor<TeachingProject>{
    List<TeachingProject> findByStatus(String status);
    List<TeachingProject> findByLeaderId(Long leaderId);
    List<TeachingProject> findByStatusIn(List<String> statuses);
    
    @Query("SELECT MAX(p.projectNumber) FROM TeachingProject p WHERE p.projectNumber LIKE CONCAT(:prefix, '%')")
    String findMaxProjectNumberByPrefix(@Param("prefix") String prefix);

}
